import Request from '../utils/request.js'
let request = new Request().http
export const getcategoods = function(id) {  
    return request({
		url:'api/goods/'+id,
    })
}
// const getGoodsCategory = (params) => vm.$u.get("/api/goods", params); //获取商品
export const getcatelist = function(data) {  
    return request({
		url:'api/goods',
		data
    })
}
// 添加购物车
export const addcarts = function(data) {
	return request({
		url: "api/carts",
		method: "POST",
		data
	})
}
export const getcarts = function(data) {
	return request({
		url: "api/carts",
		data
	})
}
export const putcarts = function(cart) {
	return request({
		url: "api/carts/" + cart,
		method:"put",
	})
}

    // vm.$u.patch("/api/carts/checked", { cart_ids: params }); //切换商品选中状态
export const deletecarts = function(cart) {
	return request({
		url: "api/carts/" + cart,
		method:"delete",
	})
}
// 购物车选中
export const patchcarts = function(params) {
	return request({
		url: "api/carts/checked",
		method:"patch",
		params
	})
}
export const upcollects = function(goods) {
	return request({
		url: "api/collects/goods/"+ goods,
		method:"post",
	})
}

// 收藏
export const getcollects = function(data) {
	return request({
		url: 'api/collects',
		data
	})
}
